package com.promise.jokerdream.ui.settings

import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.*
import androidx.compose.material3.*
import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.promise.jokerdream.database.entity.ScratchGameConfigEntity
import com.promise.jokerdream.ui.components.SettingCard
import com.promise.jokerdream.ui.components.CheckboxOptionRow
import com.promise.jokerdream.ui.components.RoundCheckbox
import com.promise.jokerdream.ui.theme.AppSpacing

/**
 * 刮刮卡设置卡片
 */
@Composable
fun ScratchSettingCard(
    config: ScratchGameConfigEntity,
    onScratchChange: (Boolean) -> Unit,
    onDailyScratchChange: (Boolean) -> Unit,
    onHourlyScratchChange: (Boolean) -> Unit,
    modifier: Modifier = Modifier,
    onExecuteClick: (() -> Unit)? = null
) {
    SettingCard(
        title = "刮刮卡",
        description = "准点刮奖在明天6点执行",
        checked = config.enabledSetting,
        onCheckedChange = onScratchChange,
        modifier = modifier,
        onExecuteClick = onExecuteClick,
        content = {
            if (config.enabledSetting) {
                Column(
                    modifier = Modifier.fillMaxWidth(),
                ) {
                    // 每日刮奖
                    CheckboxOptionRow(
                        title = "每日刮奖",
                        checked = config.dailyScratchEnabled,
                        onCheckedChange = onDailyScratchChange
                    )
                    
                    // 准点刮奖
                    CheckboxOptionRow(
                        title = "准点刮奖",
                        checked = config.hourlyScratchEnabled,
                        onCheckedChange = onHourlyScratchChange
                    )
                }
            }
        }
    )
}